﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using QLCONGNOLIBS.Models;
using QLCONGNOLIBS.Controllers;

namespace QLCONGNOAPPs.Commons
{
    public class Services
    {
        SqlConnection m_objConnection;

        public Services()
        {
            m_objConnection = new SqlConnection();
        }

        public SqlConnection getConnection()
        {
            try
            {
                ConnectObject obj = new ConnectObject();
                obj._SERVER = ConfigurationManager.AppSettings["SERVER"];
                obj._DATABASE = ConfigurationManager.AppSettings["DATABASE"];
                obj._USERNAME = ConfigurationManager.AppSettings["USERNAME"];
                obj._PASSWORD = ConfigurationManager.AppSettings["PASSWORD"];

                m_objConnection = (new ConnectionManager().SqlclientConnection(obj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return m_objConnection;
        }
    }
}
